package com.xmlt.core.template.expression;

import com.xmlt.core.template.instance.AbstractInstance;
import com.xmlt.core.template.instance.MultiInstance;

import ognl.Ognl;
import ognl.OgnlException;
import ognl.OgnlRuntime;

public class ExpressionFactory {

	static {
		OgnlRuntime.setPropertyAccessor(AbstractInstance.class, new InstancePropertyAccessor());
		OgnlRuntime.setElementsAccessor(MultiInstance.class, new InstanceElementsAccessor());
	}
	
	public static Expression getExpression(String expr) throws OgnlException {
		return new Expression(Ognl.parseExpression(expr));
	}
}
